<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>创建实例</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/lib/layui/css/layui.css">
     <link rel="stylesheet" href="/static/css/style.css">
    <script src="/static/lib/layui/layui.js"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
  <legend>创建实例</legend>
</fieldset>
<ul class="layui-nav layui-nav-tree layui-inline layui-bg-black" lay-filter="demo" style="margin-left: 10px;">
  <li class="layui-nav-item layui-nav-itemed">
  <li class="layui-nav-item"><a href="/zgh0381/instance_name/" target="content_iFrm">详细信息<span class="layui-badge-dot"></span></a></li>
  <li class="layui-nav-item"><a href="/zgh0381/select_flavor/" target="content_iFrm" >flavor<span class="layui-badge-dot"></span></a></li>
    <li class="layui-nav-item"><a href="/zgh0381/select_images/" target="content_iFrm" >源<span class="layui-badge-dot"></span></a></li>
</ul>

   <div class="parentMain" >
            <iframe name="content_iFrm" id="Parent" src="/zgh0381/instance_name/">
            </iframe>
        </div>
</div>
<button class="layui-btn layui-btn-normal"  style="margin-top: 20px; margin-left:15px" id="comfirm" type="button">启动实例</button>
<script>
    var $;
    var index = parent.layer.getFrameIndex(window.name);
    layui.use(['layer','form'], function(){
         $=layui.jquery;
             $('#cancel').on("click",function(){
            //获取当前窗口的name
                 layer.closeAll();//关闭窗口
             });
            $('#comfirm').on("click",function(){

                $.ajax({
                    url: "/zgh0381/servercreate/",  // 请求的地址
                    type: "post",  // 请求方式
                    // 请求时传递过去的数据
                    dataType: "json",  // 返回的数据格式
                    async: true,  // 异步的ajax
                }).success(function (data) {
                    if(data.res == 1) {
                            layer.confirm('创建成功!', {icon: 1, title: '创建成功'}, function (index) {
                            layer.closeAll();
                        })

                    }
                    else if(data.res == 0){
                        // 请求失败，显示错误信息
                        layer.alert('创建失败!');
                    }

                })







     });







})


</script>

</body>
</html>